home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 November: Tool Chest / Dev.CD Nov 98 TC.toast / Tool Chest / Sound / SoundApp / SoundUnit.h < prev   
Encoding:
Text File  |  1997-02-18  |  5.0 KB  |  132 lines  |  [TEXT/CWIE]

  1. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2. /*
  3. Apple Macintosh Developer Technical Support
  4.  
  5. SoundUnit
  6.  
  7. SoundUnit.h    - C public header
  8.  
  9. Versions:
  10.         1.03                January, 1990
  11.         1.04                Sept, 1990
  12.         1.2                    August, 1994        translated to C
  13.  
  14. Components:
  15.         SoundApp.c            January, 1990        MPW C source code
  16.         SoundUnit.c            January, 1990        MPW C source code
  17.         SoundUnit.h            January, 1990        MPW C source code
  18.         SoundApp.r            January, 1990        MPW Rez source code
  19.         SoundAppSnds.r        January, 1990        MPW Rez source code
  20.         SoundApp.make        January, 1990        MPW build script
  21.  
  22. Formatting was done with FONT = Courier or Monaco, SIZE = 10, TABS = 4
  23.  
  24. SoundApp.p is a sample application source file for demonstrating the
  25. Sound Manager.  This portion of the source code handles the Sound Manager
  26. porting of the application.  This SoundUnit can be used by others.
  27.  
  28. Jim Reekes E.O., Macintosh Developer Technical Support
  29. Sunday, August 7, 1994 7:06:41 PM
  30. */
  31. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  32.  
  33. #ifndef __SOUNDUNIT__
  34. #define __SOUNDUNIT__
  35.  
  36. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  37. // constants
  38. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  39.  
  40. //refer to the SoundAppSnds.r file for documentation on these values
  41. enum {
  42.     kOctave1    = 0,                    //octaves of MIDI values
  43.     kOctave2    = 12,
  44.     kOctave3    = 24,
  45.     kOctave4    = 36,
  46.     kOctave5    = 48,
  47.     kOctave6    = 60,
  48.     kOctave7    = 72,
  49.     kOctave8    = 84,
  50.     kOctave9    = 96,
  51.     kOctave10    = 108,
  52.     kOctave11    = 120,
  53.  
  54.     Akey        = -3,                    //the key A
  55.     Bbkey        = -2,                    //the key B flat
  56.     Bkey        = -1,                    //the key B
  57.     Ckey        = 0,                    //the key C
  58.     Dbkey        = 1,                    //the key D flat
  59.     Dkey        = 2,                    //the key D
  60.     Ebkey        = 3,                    //the key D flat
  61.     Ekey        = 4,                    //the key E
  62.     Fkey        = 5,                    //the key F
  63.     Gbkey        = 6,                    //the key G flat
  64.     Gkey        = 7,                    //the key G
  65.     Abkey        = 8,                    //the key A flat
  66.  
  67. //These are other constants used in the SoundUnit
  68.  
  69.     kInitNone    = 0,                    //no init options
  70.     kWait        = false,                //wait for the channel
  71.     kSMAsynch    = true,                    //asynchronous Sound Manager call
  72.     kWaveSize    = 512,                    //standard size of wave table
  73.     kSyncID        = 0x12345678,            //identifier used in syncCmd
  74.     kOneSecond    = 2000,                    //one second frequency duration
  75.  
  76.     kNoSynth    = 0                        //no synth is specified
  77. };
  78.  
  79. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  80. //types
  81. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  82.  
  83. typedef SndCommand *SndCmdPtr;    // Ptr to a sound command, for type coersion
  84.  
  85.  
  86. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  87. // prototypes
  88. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  89.  
  90. /*
  91. The routines below are for public consumption in this SoundUnit.  Note that
  92. these all return standard sound channels to allow easy of modifications.
  93. I can change the structure of my own sound channels and the code without
  94. forcing a change in the application that uses this SoundUnit.
  95.  
  96. VERSION 1.1: No longer putting the SANELib into a seperate segment, which then
  97. needs to be unloaded.  Instead, I merge it into the Main segment.  Refer to
  98. the Make file for more information.
  99. */
  100.  
  101. pascal void _SoundUnit(void);
  102. pascal OSErr InitSoundUnit(void);
  103. pascal Boolean HasMACE(void);
  104. pascal Boolean HasSoundInput(void);
  105. pascal Boolean HasStereoSupport(void);
  106. pascal short GetSoundMgrVersion(void);
  107. pascal Boolean HasSoundCompleted(void);
  108. pascal Boolean HasChannelOpen(void);
  109. pascal OSErr SendQuiet(SndChannelPtr chan, Boolean immediate);
  110. pascal void DoSoundComplete(void);
  111. pascal void FreeAllChans(void);
  112. pascal void FreeSoundUnit(void);
  113. pascal OSErr SoundComplete(SndChannelPtr chan);
  114. pascal OSErr HoldSnd(SndListHandle sndHandle);
  115. pascal OSErr PlaySong(SndChannelPtr chan, SndListHandle sndSong);
  116. pascal OSErr SetSquareWaveTimbre(SndChannelPtr squareChan, short timbre, Boolean immediate);
  117. pascal OSErr SendNote(SndChannelPtr chan, short duration, long note);
  118. pascal OSErr SendRest(SndChannelPtr chan, short duration);
  119. pascal OSErr GetSquareWaveChan(SndChannelPtr *squareChan, short timbre);
  120. pascal OSErr GetNoSynthChan(SndChannelPtr *chan);
  121. pascal OSErr GetSampleChan(SndChannelPtr *sampleChan, long init, SndListHandle sndInstrument);
  122. pascal OSErr Get4SampleInstruments(SndChannelPtr *chan1, SndChannelPtr *chan2, SndChannelPtr *chan3, SndChannelPtr *chan4, SndListHandle sndInstrument1, SndListHandle sndInstrument2, SndListHandle sndInstrument3, SndListHandle sndInstrument4);
  123. pascal Boolean HasWorkingWaveTables(void);
  124. pascal OSErr GetWaveChans(SndChannelPtr *waveChan1, SndChannelPtr *waveChan2, SndChannelPtr *waveChan3, SndChannelPtr *waveChan4);
  125. pascal OSErr InstallWave(SndChannelPtr waveChan, Ptr aWavePtr, short waveLength);
  126. pascal OSErr Play4ChanSongs(SndChannelPtr chan1, SndChannelPtr chan2, SndChannelPtr chan3, SndChannelPtr chan4, SndListHandle song1, SndListHandle song2, SndListHandle song3, SndListHandle song4);
  127. pascal long GetSndDataOffset(SndListHandle sndHandle, short *dataType, short *waveLength);
  128. pascal OSErr HyperSndPlay(SndListHandle sndHandle);
  129. pascal OSErr AsynchSndPlay(SndListHandle sndHandle);
  130.  
  131. #endif
  132.